@ECHO OFF&PUSHD %~DP0 &TITLE 绿化和选项
mode con cols=36 lines=20
color 2F
>NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
    ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
    ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
    "%TEMP%\Getadmin.vbs"
    DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
    Exit /b
)
for /F "delims=" %%i in ('dir /A:D /B') do (cd %%i)
:Menu
Cls
@ echo.
@ echo.　　　　　 菜 单 选 项
@ echo.
@ echo.     绿化[必须] → 请输入1
@ echo.
@ echo.     创建桌面图标 → 请输入2
@ echo.
@ echo.     卸载 → 请输入3
@ echo.
set /p xj= 输入数字按回车：
if /i "%xj%"=="1" Goto Install
if /i "%xj%"=="2" Goto Establish
if /i "%xj%"=="3" Goto Uninstall
@ echo.
echo      选择无效，请重新输入
ping -n 2 127.1>nul 
goto menu
:Install
@ echo.
ECHO 　　　正在安装中..请稍等..
taskkill /f /im et*>NUL 2>NUL
taskkill /f /im wpp*>NUL 2>NUL
taskkill /f /im wps*>NUL 2>NUL
taskkill /f /im wpscloudsvr*>NUL 2>NUL
cd office6
ksomisc.exe -setlng $CUR_LANG_STR$
ksomisc.exe -setservers
ksomisc.exe -register
ksomisc.exe -regmtfont
ksomisc.exe -Assoword
ksomisc.exe -Assoexcel
ksomisc.exe -Assopowerpnt
ksomisc.exe -Assopdf
ksomisc.exe -compatiblemso
ksomisc.exe -saveas_mso
ksomisc.exe -updatesaveto
ksomisc.exe -distsrc 000
ksomisc.exe -sendinstallinfo
ksomisc.exe -sendinstalldyn
ksomisc.exe -updatelink
ksomisc.exe -rebuildicon
rd/s/q "%AppData%\Kingsoft\office6"2>NUL
rd/s/q "%AppData%\Kingsoft\wps"2>NUL
del/f "%AppData%\Kingsoft\wps"2>NUL
rd/s/q "%AppData%\Kingsoft\kaccountsdk"2>NUL
rd/s/q "%AppData%\Kingsoft\kdynsdk"2>NUL
rd/s/q "%LocalAppData%\Kingsoft\WPS Cloud Files"2>nul
reg delete HKCU\Software\Kingsoft\Office /F>NUL 2>NUL
sc delete wpscloudsvr >NUL 2>NUL
reg add HKCR\.doc\WPS.Doc.6\ShellNew /v FileName /d "%cd%\mui\zh_CN\templates\newfile.wps" /F>NUL 2>NUL
reg add HKCR\.docx\WPS.Docx.6\ShellNew /v "FileName" /d "%cd%\mui\zh_CN\templates\newfile.wps" /F>NUL 2>NUL
reg add HKCR\.ppt\WPP.PPT.6\ShellNew /v "FileName" /d "%cd%\mui\zh_CN\templates\newfile.dps" /F>NUL 2>NUL
reg add HKCR\.pptx\WPP.PPTX.6\ShellNew /v "FileName" /d "%cd%\mui\zh_CN\templates\newfile.pptx" /F>NUL 2>NUL
reg add HKCR\.xls\ET.Xls.6\ShellNew /v "FileName" /d "%cd%\mui\zh_CN\templates\newfile.et" /F>NUL 2>NUL
reg add HKCR\.xlsx\ET.Xlsx.6\ShellNew /v "FileName" /d "%cd%\mui\zh_CN\templates\newfile.xlsx" /F>NUL 2>NUL
reg add HKCR\.xlsm\ET.Xlsm.6\ShellNew /v "FileName" /d "%cd%\mui\zh_CN\templates\newfile.xlsx" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\plugins\officespace /v "roaminghomepageguidedtag" /d "10.8.0.6470" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\et /v "uifile" /d "res/etongmani.kui" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\wps /v "uifile" /d "res/wpsongmani.kui" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\wpp /v "uifile" /d "res/wppongmani.kui" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\common /v "InstallRoot" /d "%~dp0" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\Common\wpshomeoptions /v "StartWithType" /t "REG_DWORD" /d "0" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\plugins\homepage /v "HasShowTip" /t "REG_SZ" /d "true" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\plugins\homepage /v "PresetChannel" /t "REG_SZ" /d "drive" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\plugins\officespace\flogin /v "userPaneShowed" /t "REG_SZ" /d "1" /F>NUL 2>NUL
reg add HKCU\Software\Kingsoft\Office\6.0\Common\updateinfo /v "UpdateRecommend" /t "REG_SZ" /d "false" /F>NUL 2>NUL
md  "%AppData%\Kingsoft\office6"2>NUL
echo.OfficeSpace>"%AppData%\Kingsoft\office6\OfficeSpace"2>NUL
echo.update>"%AppData%\Kingsoft\office6\update"2>NUL
echo.log> "%AppData%\Kingsoft\office6\log"2>NUL
echo.fonts> "%AppData%\Kingsoft\office6\fonts"2>NUL
echo.wps> "%AppData%\Kingsoft\wps"2>NUL
Attrib +r  "%AppData%\Kingsoft\office6\OfficeSpace" >NUL 2>NUL
Attrib +r  "%AppData%\Kingsoft\office6\update" >NUL 2>NUL
Attrib +r  "%AppData%\Kingsoft\office6\log" >NUL 2>NUL
Attrib +r  "%AppData%\Kingsoft\office6\fonts" >NUL 2>NUL
Attrib +r  "%AppData%\Kingsoft\wps" >NUL 2>NUL
md %AppData%\Kingsoft\office6\customui 2>NUL
cd /d %AppData%\Kingsoft\office6\customui 2>NUL
echo [common]>>ui.ini 2>NUL
echo qatUsed=true>>ui.ini 2>NUL
md "%LocalAppData%\Kingsoft\WPS Cloud Files\userdata\qing" 2>NUL
cd /d %LocalAppData%\Kingsoft\WPS Cloud Files\userdata\qing 2>NUL
echo [General]>>config.ini 2>NUL
echo autologin=1 >>config.ini 2>NUL
goto menu
:Establish
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\WPS文字.lnk""):b.TargetPath=""%cd%\office6\wps.exe"":b.WorkingDirectory=""%cd%"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\WPS演示.lnk""):b.TargetPath=""%cd%\office6\wpp.exe"":b.WorkingDirectory=""%cd%"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\WPS表格.lnk""):b.TargetPath=""%cd%\office6\et.exe"":b.WorkingDirectory=""%cd%"":b.Save:close")
goto menu
:Uninstall
@ echo.
echo 　　　正在卸载中..请稍等..
taskkill /f /im et*>NUL 2>NUL
taskkill /f /im wpp*>NUL 2>NUL
taskkill /f /im wps*>NUL 2>NUL
taskkill /f /im wpscloudsvr*>NUL 2>NUL
cd office6
ksomisc.exe -rename 2052 uninstall
ksomisc.exe -externaltask delete
ksomisc.exe -uncompatiblemso
ksomisc.exe -unassoword
ksomisc.exe -unassopowerpnt
ksomisc.exe -unassoexcel
ksomisc.exe -unassopdf
ksomisc.exe -unregister
ksomisc.exe -unregmtfont
ksomisc.exe -unregksee -forceperusermode
ksomisc.exe -unassoofficexml
ksomisc.exe -rebuildicon
ksomisc.exe -unreg_wps
ksomisc.exe -unreg_wpp
ksomisc.exe -unreg_et
ksomisc.exe -unregksee
ksomisc.exe -unreg_kso
ksomisc.exe -unreg_kde
ksomisc.exe -unregoledefhndlr
ksomisc.exe -unregmtfont
sc delete wpscloudsvr >NUL 2>NUL
reg delete "HKCR\.doc\WPS.Doc.6" /F>NUL 2>NUL
reg delete "HKCR\.docx\WPS.Docx.6" /F>NUL 2>NUL
reg delete "HKCR\.ppt\WPP.PPT.6" /F>NUL 2>NUL
reg delete "HKCR\.pptx\WPP.PPTX.6" /F>NUL 2>NUL
reg delete "HKCR\.xls\ET.Xls.6" /F>NUL 2>NUL
reg delete "HKCR\.xlsx\ET.Xlsx.6" /F>NUL 2>NUL
reg delete "HKCR\.xlsm\ET.Xlsm.6" /F>NUL 2>NUL
reg delete "HKCU\Software\Kingsoft\Office" /F>NUL 2>NUL
reg delete "HKCU\Software\Kingsoft\wpscloud" /F>NUL 2>NUL
rd/s/q "%AppData%\Kingsoft\office6"2>NUL
rd/s/q "%AppData%\Kingsoft\wps"2>NUL
del/f "%AppData%\Kingsoft\wps"2>NUL
rd/s/q "%AppData%\Kingsoft\kaccountsdk"2>NUL
rd/s/q "%AppData%\Kingsoft\kdynsdk"2>NUL
rd/s/q "%LocalAppData%\Kingsoft\WPS Cloud Files"2>nul
del/f/q "%userprofile%\Desktop\WPS表格.lnk" >nul 2>nul
del/f/q "%userprofile%\Desktop\WPS演示.lnk" >nul 2>nul
del/f/q "%userprofile%\Desktop\WPS文字.lnk" >nul 2>nul
del/f/q "%userprofile%\桌面\WPS表格.lnk" >nul 2>nul
del/f/q "%userprofile%\桌面\WPS演示.lnk" >nul 2>nul
del/f/q "%userprofile%\桌面\WPS文字.lnk" >nul 2>nul
del/f/q "%public%\Desktop\WPS表格.lnk" >nul 2>nul
del/f/q "%public%\Desktop\WPS演示.lnk" >nul 2>nul
del/f/q "%public%\Desktop\WPS文字.lnk" >nul 2>nul
del/f/q "%public%\桌面\WPS表格.lnk" >nul 2>nul
del/f/q "%public%\桌面\WPS演示.lnk" >nul 2>nul
del/f/q "%public%\桌面\WPS文字.lnk" >nul 2>nul
goto menu